﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using caedisi.Web.DataModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using caedisi.Models;
using System.Windows.Controls;
using System.Windows;

namespace caedisi.Views
{
    /// <summary>
    /// 
    /// </summary>
    public partial class PartitionValidationReport : ChildWindow, INotifyPropertyChanged
    {
        private string _IsIntersectionVisible = "Visible";
        /// <summary>
        /// Gets or sets the is intersection error message visible.
        /// </summary>
        /// <value>
        /// The is intersection error visible.
        /// </value>
        public string IsIntersectionVisible
        {
            get
            {
                return _IsIntersectionVisible;
            }
            set
            {
                if (_IsIntersectionVisible != value)
                {
                    _IsIntersectionVisible = value;
                    this.RaisePropertyChanged("IsIntersectionVisible");

                }
            }
        }


        private string _IsNotUsedVisible = "Visible";
        /// <summary>
        /// Gets or sets the is not used cells error message visible.
        /// </summary>
        /// <value>
        /// The is not used cells visible.
        /// </value>
        public string IsNotUsedVisible
        {
            get
            {
                return _IsNotUsedVisible;
            }
            set
            {
                if (_IsNotUsedVisible != value)
                {
                    _IsNotUsedVisible = value;
                    this.RaisePropertyChanged("IsNotUsedVisible");

                }
            }
        }


        private Collection<String> _IntersectionErrors;
        /// <summary>
        /// Gets or sets the intersection errors.
        /// </summary>
        /// <value>
        /// The intersection errors.
        /// </value>
        public Collection<String> IntersectionErrors
        {
            get
            {
                return _IntersectionErrors;
            }
            set
            {
                if (_IntersectionErrors != value)
                {
                    _IntersectionErrors = value;
                    this.RaisePropertyChanged("TransitionRulesCollisionErrors");

                }
            }

        }

        public bool IsListBoxIntersectionVisible { get { return (this.IntersectionErrors == null || (this.IntersectionErrors != null && this.IntersectionErrors.Count > 0)); } }


        private Collection<String> _EmptyErrors;
        /// <summary>
        /// Gets or sets the not used cells errors.
        /// </summary>
        /// <value>
        /// The not used cells errors.
        /// </value>
        public Collection<String> EmptyErrors
        {
            get
            {
                return _EmptyErrors;
            }
            set
            {
                if (_EmptyErrors != value)
                {
                    _EmptyErrors = value;
                    this.RaisePropertyChanged("EmptyErrors");

                }
            }
        }

        public bool IsListBoxNotUsedCellVisible { get { return (this.EmptyErrors == null || (this.EmptyErrors != null && this.EmptyErrors.Count > 0)); } }

        /// <summary>
        /// Initializes a new instance of the <see cref="TransitionRulesValidationReport"/> class.
        /// </summary>
        public PartitionValidationReport(Collection<String> intersectionErrors, Collection<String> notUsedErrors, String isIntersectionErrorVisible, String isNotUsedErrorVisible)
        {
            InitializeComponent();

            this._IntersectionErrors = intersectionErrors;
            this._EmptyErrors = notUsedErrors;
            this._IsIntersectionVisible = isIntersectionErrorVisible;
            this._IsNotUsedVisible = isNotUsedErrorVisible;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TransitionRulesValidationReport"/> class.
        /// </summary>
        public PartitionValidationReport()
        {
            InitializeComponent();
        }

        private void CorrectErrorsButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        #region INotifiedPropertyChange
        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Raises the property changed.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}

